package day05;

import java.lang.reflect.Array;
import java.util.Arrays;

public class ArrayDemo {
    public static void main(String[] args) {
        /*int[] a= new int[3];
        boolean[] b =new boolean[20];
        short[] c =new short[4];
        byte[]d= new byte[6];
        double[] e= new double[6];
        int [] A={5,5,5};

        c[0]=2;
        c[3]=11;
        System.out.println(c[0]);
        System.out.println(d.length);

         */
        //int [] a;
        //a={1,2,6,};报错原因不能喝a分离,要么直接写,
        //a = new int[]{1,2,3,4,5};
      /*  int[]a={1,2,3,4,5};
        System.out.println(a[3]);

        int[] b=new int[]{2,4,6,11,};
        b=new int[]{1,2,3,4,};
        System.out.println(b[4]);
       */
        /*int[] a = new int[6];
        a[0]=10;
        a[1]=20;
        a[2]=30;
        a[3]=15;
        a[5]=20;
        System.out.println(a[a.length-1]);
        System.out.println(a[5]);
         */
        /*
        int[ ] arr= new int[10];
        for (int i=0;i<arr.length;i++){
            arr[i]=(int)(Math.random()*100);
            System.out.println(arr[i]);
        }
         */
        /*
        int[] arr = {55,66,88,56,87,97,66};
        int[] arr1=new int[3];
        System.arraycopy(arr,3,arr1,0,2);
        for (int i=0;i<arr1.length;i++){
            System.out.println(arr1[i]);
        }
         */
        int[] arr={55,66,77,65,85,65,11};
        int[] b= Arrays.copyOf(arr,4);
        for (int i = 0; i < b.length; i++) {
            System.out.println(b[i]);
        }

    }
}
